Implement internal linking and two pass single page rendering for generated PDFs#13161
Merged
eugene-manuilov merged 4 commits intoJul 24, 2026
Conversation
📚 Storybook for 9806866:
📦 Build files for 9806866:
🎭 Playwright reports for 9806866: |
zutigrm
reviewed
Jul 22, 2026
Collaborator
There was a problem hiding this comment.
Thanks @benbowler looks good overall, I just have one question bellow
Also there are merge conflicts that need to be resolved
eugene-manuilov
approved these changes
Jul 24, 2026
eugene-manuilov
deleted the
enhancement/12553-pdf-internal-linking-two-pass-rendering
branch
July 24, 2026 12:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses issue:
Relevant technical choices
DocumentonRendercallback, then the final pass renders the page bounded to the measured height plus a fixed bottom padding.measurePDFContentHeightreads the undocumented_INTERNAL__LAYOUT__DATA_layout result and throws a clear error naming the expected property path when the shape is unrecognised, so a library upgrade fails the export cleanly instead of producing a broken PDF. Errors thrown insideonRenderare captured and rethrown after the render, since@react-pdfmay swallow exceptions raised in its render pipeline.<Link src="#section-{slug}">.@react-pdfregisters a named destination from a node's parent-relative top, so anidnested inside the report body lands the viewer a header height above the section. To anchor correctly, the measurement pass also extracts each section's absolute top (extractPDFSectionAnchors), and the final pass pins zero-size, absolutely positioned anchor views carrying the ids directly on the page, where relative and absolute tops coincide. Verified against the real library: destinations land exactly at each section's position.@react-pdfsizes awrap={false}page to its content and ignores the requested height, so the fixed bottom padding is applied through the page'spaddingBottom; this makes the rendered page height equal the computed measured height plus padding, with the explicitsizeheight kept as an upper bound.toBlob()now fires the document'sonRendercallback with a layout fixture mirroring the internal shape, so the two-pass flow is exercised in unit tests.PR Author Checklist
Do not alter or remove anything below. The following sections will be managed by moderators only.
Code Reviewer Checklist
Merge Reviewer Checklist